/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import editcontact.EditContact_Stub;
import java.rmi.RemoteException;
import java.util.Enumeration;
import javax.microedition.midlet.*;
import org.netbeans.microedition.lcdui.LoginScreen;
import org.netbeans.microedition.lcdui.SplashScreen;
import org.netbeans.microedition.lcdui.WaitScreen;
import org.netbeans.microedition.util.SimpleCancellableTask;
import javax.microedition.lcdui.*;
import javax.microedition.pim.*;

/**
 * @author mrxx
 */
public class MrMobileMain extends MIDlet implements CommandListener {

    private boolean midletPaused = false;

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private SplashScreen Loading;
    private LoginScreen Login;
    private Form HomePage;
    private StringItem stringItem;
    private Form LoginFailed;
    private StringItem stringItem1;
    private Form Info;
    private StringItem stringItem2;
    private WaitScreen Backup;
    private Form BackupFailed;
    private StringItem stringItem6;
    private StringItem stringItem10;
    private Form BackupSuccess;
    private StringItem stringItem3;
    private StringItem stringItem9;
    private WaitScreen Restore;
    private Form RestoreSuccess;
    private StringItem stringItem7;
    private StringItem stringItem4;
    private Form RestoreFailed;
    private StringItem stringItem5;
    private StringItem stringItem8;
    private Command exitCommand2;
    private Command backCommand2;
    private Command exitCommand1;
    private Command exitCommand3;
    private Command okCommand1;
    private Command helpCommand1;
    private Command backCommand3;
    private Command backCommand4;
    private Command okCommand;
    private Command backCommand;
    private Command backCommand1;
    private Command exitCommand4;
    private Command exitCommand;
    private Command cancelCommand;
    private Command cancelCommand1;
    private Command exitCommand6;
    private Command exitCommand5;
    private Command backCommand5;
    private Command backCommand6;
    private Image image1;
    private SimpleCancellableTask task;
    private SimpleCancellableTask task1;
    //</editor-fold>//GEN-END:|fields|0|
    boolean loginFlag;
    String accountUsername;
    String accountPassword;
    PIMList pimlist;
    ContactList clist = null;
    PIM pim;
    int contactCount;
    String  contacts [][]  ;

    /**
     * The MrMobileMain constructor.
     */
    public MrMobileMain() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getLoading());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == Backup) {//GEN-BEGIN:|7-commandAction|1|124-preAction
            if (command == WaitScreen.FAILURE_COMMAND) {//GEN-END:|7-commandAction|1|124-preAction
                // write pre-action user code here
                switchDisplayable(null, getBackupFailed());//GEN-LINE:|7-commandAction|2|124-postAction
                // write post-action user code here
            } else if (command == WaitScreen.SUCCESS_COMMAND) {//GEN-LINE:|7-commandAction|3|123-preAction
                // write pre-action user code here
                switchDisplayable(null, getBackupSuccess());//GEN-LINE:|7-commandAction|4|123-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|5|141-preAction
        } else if (displayable == BackupFailed) {
            if (command == backCommand1) {//GEN-END:|7-commandAction|5|141-preAction
                // write pre-action user code here
                switchDisplayable(null, getHomePage());//GEN-LINE:|7-commandAction|6|141-postAction
                // write post-action user code here
            } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|7|145-preAction
                // write pre-action user code here
                switchDisplayable(null, getBackup());//GEN-LINE:|7-commandAction|8|145-postAction
                // write post-action user code here
            } else if (command == exitCommand4) {//GEN-LINE:|7-commandAction|9|143-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|10|143-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|11|137-preAction
        } else if (displayable == BackupSuccess) {
            if (command == backCommand) {//GEN-END:|7-commandAction|11|137-preAction
                // write pre-action user code here
                switchDisplayable(null, getHomePage());//GEN-LINE:|7-commandAction|12|137-postAction
                // write post-action user code here
            } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|13|135-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|14|135-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|15|72-preAction
        } else if (displayable == HomePage) {
            if (command == backCommand2) {//GEN-END:|7-commandAction|15|72-preAction
                // write pre-action user code here
                switchDisplayable(null, getLogin());//GEN-LINE:|7-commandAction|16|72-postAction
                // write post-action user code here
            } else if (command == exitCommand2) {//GEN-LINE:|7-commandAction|17|70-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|18|70-postAction
                // write post-action user code here
            } else if (command == helpCommand1) {//GEN-LINE:|7-commandAction|19|76-preAction
                // write pre-action user code here
                switchDisplayable(null, getInfo());//GEN-LINE:|7-commandAction|20|76-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|21|121-preAction
                // write pre-action user code here
                switchDisplayable(null, getRestore());//GEN-LINE:|7-commandAction|22|121-postAction
                // write post-action user code here
            } else if (command == okCommand1) {//GEN-LINE:|7-commandAction|23|74-preAction
                // write pre-action user code here
                switchDisplayable(null, getBackup());//GEN-LINE:|7-commandAction|24|74-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|25|91-preAction
        } else if (displayable == Info) {
            if (command == backCommand4) {//GEN-END:|7-commandAction|25|91-preAction
                // write pre-action user code here
                switchDisplayable(null, getHomePage());//GEN-LINE:|7-commandAction|26|91-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|27|29-preAction
        } else if (displayable == Loading) {
            if (command == SplashScreen.DISMISS_COMMAND) {//GEN-END:|7-commandAction|27|29-preAction
                // write pre-action user code here
                switchDisplayable(null, getLogin());//GEN-LINE:|7-commandAction|28|29-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|29|56-preAction
        } else if (displayable == Login) {
            if (command == LoginScreen.LOGIN_COMMAND) {//GEN-END:|7-commandAction|29|56-preAction
                verifyaccount.VerifyAccount_Stub va = new verifyaccount.VerifyAccount_Stub();
                try {
                    loginFlag = va.execute(Login.getUsername(), Login.getPassword()); // write pre-action user code here
                } catch (RemoteException ex) {
                    ex.printStackTrace();
                }

                isVerified();//GEN-LINE:|7-commandAction|30|56-postAction
                // write post-action user code here
            } else if (command == exitCommand1) {//GEN-LINE:|7-commandAction|31|67-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|32|67-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|33|82-preAction
        } else if (displayable == LoginFailed) {
            if (command == backCommand3) {//GEN-END:|7-commandAction|33|82-preAction
                // write pre-action user code here
                switchDisplayable(null, getLogin());//GEN-LINE:|7-commandAction|34|82-postAction
                // write post-action user code here
            } else if (command == exitCommand3) {//GEN-LINE:|7-commandAction|35|80-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|36|80-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|37|154-preAction
        } else if (displayable == Restore) {
            if (command == WaitScreen.FAILURE_COMMAND) {//GEN-END:|7-commandAction|37|154-preAction
                // write pre-action user code here
                switchDisplayable(null, getRestoreFailed());//GEN-LINE:|7-commandAction|38|154-postAction
                // write post-action user code here
            } else if (command == WaitScreen.SUCCESS_COMMAND) {//GEN-LINE:|7-commandAction|39|153-preAction
                // write pre-action user code here
                switchDisplayable(null, getRestoreSuccess());//GEN-LINE:|7-commandAction|40|153-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|41|168-preAction
        } else if (displayable == RestoreFailed) {
            if (command == backCommand6) {//GEN-END:|7-commandAction|41|168-preAction
                // write pre-action user code here
                switchDisplayable(null, getHomePage());//GEN-LINE:|7-commandAction|42|168-postAction
                // write post-action user code here
            } else if (command == cancelCommand1) {//GEN-LINE:|7-commandAction|43|172-preAction
                // write pre-action user code here
                switchDisplayable(null, getRestore());//GEN-LINE:|7-commandAction|44|172-postAction
                // write post-action user code here
            } else if (command == exitCommand6) {//GEN-LINE:|7-commandAction|45|170-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|46|170-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|47|162-preAction
        } else if (displayable == RestoreSuccess) {
            if (command == backCommand5) {//GEN-END:|7-commandAction|47|162-preAction
                // write pre-action user code here
                switchDisplayable(null, getHomePage());//GEN-LINE:|7-commandAction|48|162-postAction
                // write post-action user code here
            } else if (command == exitCommand5) {//GEN-LINE:|7-commandAction|49|164-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|50|164-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|51|7-postCommandAction
        }//GEN-END:|7-commandAction|51|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|52|
    //</editor-fold>//GEN-END:|7-commandAction|52|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Loading ">//GEN-BEGIN:|28-getter|0|28-preInit
    /**
     * Returns an initiliazed instance of Loading component.
     * @return the initialized component instance
     */
    public SplashScreen getLoading() {
        if (Loading == null) {//GEN-END:|28-getter|0|28-preInit
            // write pre-init user code here
            Loading = new SplashScreen(getDisplay());//GEN-BEGIN:|28-getter|1|28-postInit
            Loading.setTitle("Loading...");
            Loading.setCommandListener(this);
            Loading.setImage(getImage1());
            Loading.setText("Mr. Mobile");//GEN-END:|28-getter|1|28-postInit
            // write post-init user code here
        }//GEN-BEGIN:|28-getter|2|
        return Loading;
    }
    //</editor-fold>//GEN-END:|28-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: isVerified ">//GEN-BEGIN:|58-if|0|58-preIf
    /**
     * Performs an action assigned to the isVerified if-point.
     */
    public void isVerified() {//GEN-END:|58-if|0|58-preIf
        // enter pre-if user code here
        if (loginFlag) {//GEN-LINE:|58-if|1|59-preAction
            // write pre-action user code here
            switchDisplayable(null, getHomePage());//GEN-LINE:|58-if|2|59-postAction
            // write post-action user code here
            accountUsername = Login.getUsername();
            accountPassword = Login.getPassword();
        } else {//GEN-LINE:|58-if|3|60-preAction
            // write pre-action user code here
            switchDisplayable(null, getLoginFailed());//GEN-LINE:|58-if|4|60-postAction
            // write post-action user code here
        }//GEN-LINE:|58-if|5|58-postIf
        // enter post-if user code here
    }//GEN-BEGIN:|58-if|6|
    //</editor-fold>//GEN-END:|58-if|6|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Login ">//GEN-BEGIN:|54-getter|0|54-preInit
    /**
     * Returns an initiliazed instance of Login component.
     * @return the initialized component instance
     */
    public LoginScreen getLogin() {
        if (Login == null) {//GEN-END:|54-getter|0|54-preInit
            // write pre-init user code here
            Login = new LoginScreen(getDisplay());//GEN-BEGIN:|54-getter|1|54-postInit
            Login.setLabelTexts("Username", "Password");
            Login.setTitle("Mr. Mobile");
            Login.addCommand(LoginScreen.LOGIN_COMMAND);
            Login.addCommand(getExitCommand1());
            Login.setCommandListener(this);
            Login.setBGColor(-3355444);
            Login.setFGColor(0);
            Login.setUseLoginButton(false);
            Login.setLoginButtonText("Login");//GEN-END:|54-getter|1|54-postInit
            // write post-init user code here
        }//GEN-BEGIN:|54-getter|2|
        return Login;
    }
    //</editor-fold>//GEN-END:|54-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: LoginFailed ">//GEN-BEGIN:|62-getter|0|62-preInit
    /**
     * Returns an initiliazed instance of LoginFailed component.
     * @return the initialized component instance
     */
    public Form getLoginFailed() {
        if (LoginFailed == null) {//GEN-END:|62-getter|0|62-preInit
            // write pre-init user code here
            LoginFailed = new Form("Login Failed", new Item[] { getStringItem1() });//GEN-BEGIN:|62-getter|1|62-postInit
            LoginFailed.addCommand(getExitCommand3());
            LoginFailed.addCommand(getBackCommand3());
            LoginFailed.setCommandListener(this);//GEN-END:|62-getter|1|62-postInit
            // write post-init user code here
        }//GEN-BEGIN:|62-getter|2|
        return LoginFailed;
    }
    //</editor-fold>//GEN-END:|62-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem1 ">//GEN-BEGIN:|78-getter|0|78-preInit
    /**
     * Returns an initiliazed instance of stringItem1 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem1() {
        if (stringItem1 == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            stringItem1 = new StringItem("Incorrect username or password", "");//GEN-LINE:|78-getter|1|78-postInit
            // write post-init user code here
        }//GEN-BEGIN:|78-getter|2|
        return stringItem1;
    }
    //</editor-fold>//GEN-END:|78-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: HomePage ">//GEN-BEGIN:|63-getter|0|63-preInit
    /**
     * Returns an initiliazed instance of HomePage component.
     * @return the initialized component instance
     */
    public Form getHomePage() {
        if (HomePage == null) {//GEN-END:|63-getter|0|63-preInit
            // write pre-init user code here
            HomePage = new Form("Home Page", new Item[] { getStringItem() });//GEN-BEGIN:|63-getter|1|63-postInit
            HomePage.addCommand(getExitCommand2());
            HomePage.addCommand(getBackCommand2());
            HomePage.addCommand(getOkCommand1());
            HomePage.addCommand(getHelpCommand1());
            HomePage.addCommand(getOkCommand());
            HomePage.setCommandListener(this);//GEN-END:|63-getter|1|63-postInit
            // write post-init user code here
        }//GEN-BEGIN:|63-getter|2|
        return HomePage;
    }
    //</editor-fold>//GEN-END:|63-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">//GEN-BEGIN:|77-getter|0|77-preInit
    /**
     * Returns an initiliazed instance of stringItem component.
     * @return the initialized component instance
     */
    public StringItem getStringItem() {
        if (stringItem == null) {//GEN-END:|77-getter|0|77-preInit
            // write pre-init user code here
            stringItem = new StringItem("Welcome to Mr. Mobile", "");//GEN-LINE:|77-getter|1|77-postInit
            // write post-init user code here
        }//GEN-BEGIN:|77-getter|2|
        return stringItem;
    }
    //</editor-fold>//GEN-END:|77-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|66-getter|0|66-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|66-getter|0|66-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|66-getter|1|66-postInit
            // write post-init user code here
        }//GEN-BEGIN:|66-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|66-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand2 ">//GEN-BEGIN:|69-getter|0|69-preInit
    /**
     * Returns an initiliazed instance of exitCommand2 component.
     * @return the initialized component instance
     */
    public Command getExitCommand2() {
        if (exitCommand2 == null) {//GEN-END:|69-getter|0|69-preInit
            // write pre-init user code here
            exitCommand2 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|69-getter|1|69-postInit
            // write post-init user code here
        }//GEN-BEGIN:|69-getter|2|
        return exitCommand2;
    }
    //</editor-fold>//GEN-END:|69-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand2 ">//GEN-BEGIN:|71-getter|0|71-preInit
    /**
     * Returns an initiliazed instance of backCommand2 component.
     * @return the initialized component instance
     */
    public Command getBackCommand2() {
        if (backCommand2 == null) {//GEN-END:|71-getter|0|71-preInit
            // write pre-init user code here
            backCommand2 = new Command("Logout", Command.BACK, 0);//GEN-LINE:|71-getter|1|71-postInit
            // write post-init user code here
        }//GEN-BEGIN:|71-getter|2|
        return backCommand2;
    }
    //</editor-fold>//GEN-END:|71-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|73-getter|0|73-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|73-getter|0|73-preInit
            // write pre-init user code here
            okCommand1 = new Command("Backup contacts", Command.OK, 0);//GEN-LINE:|73-getter|1|73-postInit
            // write post-init user code here
        }//GEN-BEGIN:|73-getter|2|
        return okCommand1;
    }
    //</editor-fold>//GEN-END:|73-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: helpCommand1 ">//GEN-BEGIN:|75-getter|0|75-preInit
    /**
     * Returns an initiliazed instance of helpCommand1 component.
     * @return the initialized component instance
     */
    public Command getHelpCommand1() {
        if (helpCommand1 == null) {//GEN-END:|75-getter|0|75-preInit
            // write pre-init user code here
            helpCommand1 = new Command("About Mr. Mobile", Command.HELP, 0);//GEN-LINE:|75-getter|1|75-postInit
            // write post-init user code here
        }//GEN-BEGIN:|75-getter|2|
        return helpCommand1;
    }
    //</editor-fold>//GEN-END:|75-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand3 ">//GEN-BEGIN:|79-getter|0|79-preInit
    /**
     * Returns an initiliazed instance of exitCommand3 component.
     * @return the initialized component instance
     */
    public Command getExitCommand3() {
        if (exitCommand3 == null) {//GEN-END:|79-getter|0|79-preInit
            // write pre-init user code here
            exitCommand3 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|79-getter|1|79-postInit
            // write post-init user code here
        }//GEN-BEGIN:|79-getter|2|
        return exitCommand3;
    }
    //</editor-fold>//GEN-END:|79-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand3 ">//GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of backCommand3 component.
     * @return the initialized component instance
     */
    public Command getBackCommand3() {
        if (backCommand3 == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            backCommand3 = new Command("Retry", Command.BACK, 0);//GEN-LINE:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return backCommand3;
    }
    //</editor-fold>//GEN-END:|81-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|85-getter|0|85-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|85-getter|0|85-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|85-getter|1|85-@java.io.IOException
                image1 = Image.createImage("/Logo2.jpg");
            } catch (java.io.IOException e) {//GEN-END:|85-getter|1|85-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|85-getter|2|85-postInit
            // write post-init user code here
        }//GEN-BEGIN:|85-getter|3|
        return image1;
    }
    //</editor-fold>//GEN-END:|85-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Info ">//GEN-BEGIN:|88-getter|0|88-preInit
    /**
     * Returns an initiliazed instance of Info component.
     * @return the initialized component instance
     */
    public Form getInfo() {
        if (Info == null) {//GEN-END:|88-getter|0|88-preInit
            // write pre-init user code here
            Info = new Form("About Mr. Mobile", new Item[] { getStringItem2() });//GEN-BEGIN:|88-getter|1|88-postInit
            Info.addCommand(getBackCommand4());
            Info.setCommandListener(this);//GEN-END:|88-getter|1|88-postInit
            // write post-init user code here
        }//GEN-BEGIN:|88-getter|2|
        return Info;
    }
    //</editor-fold>//GEN-END:|88-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem2 ">//GEN-BEGIN:|89-getter|0|89-preInit
    /**
     * Returns an initiliazed instance of stringItem2 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem2() {
        if (stringItem2 == null) {//GEN-END:|89-getter|0|89-preInit
            // write pre-init user code here
            stringItem2 = new StringItem("Mr. Mobile is used to backup important data on your mobile phone like contacts, SMS, calender, multimedia files, etc...", "");//GEN-LINE:|89-getter|1|89-postInit
            // write post-init user code here
        }//GEN-BEGIN:|89-getter|2|
        return stringItem2;
    }
    //</editor-fold>//GEN-END:|89-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand4 ">//GEN-BEGIN:|90-getter|0|90-preInit
    /**
     * Returns an initiliazed instance of backCommand4 component.
     * @return the initialized component instance
     */
    public Command getBackCommand4() {
        if (backCommand4 == null) {//GEN-END:|90-getter|0|90-preInit
            // write pre-init user code here
            backCommand4 = new Command("Back", Command.BACK, 0);//GEN-LINE:|90-getter|1|90-postInit
            // write post-init user code here
        }//GEN-BEGIN:|90-getter|2|
        return backCommand4;
    }
    //</editor-fold>//GEN-END:|90-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">//GEN-BEGIN:|120-getter|0|120-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|120-getter|0|120-preInit
            // write pre-init user code here
            okCommand = new Command("Restore contacts", Command.OK, 0);//GEN-LINE:|120-getter|1|120-postInit
            // write post-init user code here
        }//GEN-BEGIN:|120-getter|2|
        return okCommand;
    }
    //</editor-fold>//GEN-END:|120-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Backup ">//GEN-BEGIN:|122-getter|0|122-preInit
    /**
     * Returns an initiliazed instance of Backup component.
     * @return the initialized component instance
     */
    public WaitScreen getBackup() {
        if (Backup == null) {//GEN-END:|122-getter|0|122-preInit
            // write pre-init user code here
            Backup = new WaitScreen(getDisplay());//GEN-BEGIN:|122-getter|1|122-postInit
            Backup.setTitle("Backup");
            Backup.setCommandListener(this);
            Backup.setImage(getImage1());
            Backup.setText("Backup is in progress, please be patient..");
            Backup.setTask(getTask());//GEN-END:|122-getter|1|122-postInit
            // write post-init user code here
        }//GEN-BEGIN:|122-getter|2|
        return Backup;
    }
    //</editor-fold>//GEN-END:|122-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: task ">//GEN-BEGIN:|125-getter|0|125-preInit
    /**
     * Returns an initiliazed instance of task component.
     * @return the initialized component instance
     */
    public SimpleCancellableTask getTask() {
        if (task == null) {//GEN-END:|125-getter|0|125-preInit
            // write pre-init user code here
            task = new SimpleCancellableTask();//GEN-BEGIN:|125-getter|1|125-execute
            task.setExecutable(new org.netbeans.microedition.util.Executable() {
                public void execute() throws Exception {//GEN-END:|125-getter|1|125-execute
                pim = PIM.getInstance();
                Contact contact=null;
                Enumeration enumeration = null;
                String[] lists = pim.listPIMLists(pim.CONTACT_LIST);
                String contactName="";
                String contactNo="";

		for (int i = 0; i < lists.length; i++)
		{
                    try {
                        pimlist = pim.openPIMList(pim.CONTACT_LIST, pim.READ_WRITE);
                    } catch (PIMException ex) {
                        ex.printStackTrace();
                    }
		try{
		enumeration = pimlist.items();
		}catch(Exception e){}

		while (enumeration.hasMoreElements())
		{
		 contact	=	(Contact)enumeration.nextElement();

		 try{
			if(pimlist.isSupportedField(Contact.FORMATTED_NAME)&& (contact.countValues(Contact.FORMATTED_NAME) >0))
			 {
				contactName = contact.getString(Contact.FORMATTED_NAME,0);
			 }
                        else if(pimlist.isSupportedField(Contact.TITLE)&& (contact.countValues(Contact.TITLE) >0))
			 {
				contactName = contact.getString(Contact.TITLE,0);
			 }
                         }catch( Exception e){}

		int phoneNos = contact.countValues(Contact.TEL);
		try{
			if(pimlist.isSupportedField(Contact.TEL) &&(contact.countValues(Contact.TEL) >0))
			contactNo = contact.getString(contact.TEL,0);
			}catch( Exception e){}
                        synchronize.Synchronize_Stub sync = new synchronize.Synchronize_Stub();
                        String syncNumber = null;
                        try {
                            syncNumber = sync.getContactNumber(accountUsername, contactName);
                        } catch (RemoteException ex) {
                            ex.printStackTrace();
                        }
                        if ( !contactNo.equals(syncNumber))
                        {
                            if ( syncNumber.equals("false"))
                            {
                                addcontact.AddContact_Stub ac = new addcontact.AddContact_Stub();
                                try {
                                    ac.execute(accountUsername, contactName, contactNo);
                                } catch (RemoteException ex) {
                                    ex.printStackTrace();
                                }
                            }
                            else
                            {
                                editcontact.EditContact_Stub ec = new editcontact.EditContact_Stub();
                                try {
                                    ec.editNumber(accountUsername, contactName, contactNo);
                                } catch (RemoteException ex) {
                                    ex.printStackTrace();
                                }
                            }
                        }
                    }
                }// write task-execution user code here
                }//GEN-BEGIN:|125-getter|2|125-postInit
            });//GEN-END:|125-getter|2|125-postInit
            // write post-init user code here
        }//GEN-BEGIN:|125-getter|3|
        return task;
    }
    //</editor-fold>//GEN-END:|125-getter|3|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: BackupSuccess ">//GEN-BEGIN:|130-getter|0|130-preInit
    /**
     * Returns an initiliazed instance of BackupSuccess component.
     * @return the initialized component instance
     */
    public Form getBackupSuccess() {
        if (BackupSuccess == null) {//GEN-END:|130-getter|0|130-preInit
            // write pre-init user code here
            BackupSuccess = new Form("Backup Successful", new Item[] { getStringItem3(), getStringItem9() });//GEN-BEGIN:|130-getter|1|130-postInit
            BackupSuccess.addCommand(getExitCommand());
            BackupSuccess.addCommand(getBackCommand());
            BackupSuccess.setCommandListener(this);//GEN-END:|130-getter|1|130-postInit
            // write post-init user code here
        }//GEN-BEGIN:|130-getter|2|
        return BackupSuccess;
    }
    //</editor-fold>//GEN-END:|130-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: BackupFailed ">//GEN-BEGIN:|131-getter|0|131-preInit
    /**
     * Returns an initiliazed instance of BackupFailed component.
     * @return the initialized component instance
     */
    public Form getBackupFailed() {
        if (BackupFailed == null) {//GEN-END:|131-getter|0|131-preInit
            // write pre-init user code here
            BackupFailed = new Form("Backup Failed", new Item[] { getStringItem6(), getStringItem10() });//GEN-BEGIN:|131-getter|1|131-postInit
            BackupFailed.addCommand(getBackCommand1());
            BackupFailed.addCommand(getExitCommand4());
            BackupFailed.addCommand(getCancelCommand());
            BackupFailed.setCommandListener(this);//GEN-END:|131-getter|1|131-postInit
            // write post-init user code here
        }//GEN-BEGIN:|131-getter|2|
        return BackupFailed;
    }
    //</editor-fold>//GEN-END:|131-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|134-getter|0|134-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|134-getter|0|134-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|134-getter|1|134-postInit
            // write post-init user code here
        }//GEN-BEGIN:|134-getter|2|
        return exitCommand;
    }
    //</editor-fold>//GEN-END:|134-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|136-getter|0|136-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|136-getter|0|136-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|136-getter|1|136-postInit
            // write post-init user code here
        }//GEN-BEGIN:|136-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|136-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand1 ">//GEN-BEGIN:|140-getter|0|140-preInit
    /**
     * Returns an initiliazed instance of backCommand1 component.
     * @return the initialized component instance
     */
    public Command getBackCommand1() {
        if (backCommand1 == null) {//GEN-END:|140-getter|0|140-preInit
            // write pre-init user code here
            backCommand1 = new Command("Back", Command.BACK, 0);//GEN-LINE:|140-getter|1|140-postInit
            // write post-init user code here
        }//GEN-BEGIN:|140-getter|2|
        return backCommand1;
    }
    //</editor-fold>//GEN-END:|140-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand4 ">//GEN-BEGIN:|142-getter|0|142-preInit
    /**
     * Returns an initiliazed instance of exitCommand4 component.
     * @return the initialized component instance
     */
    public Command getExitCommand4() {
        if (exitCommand4 == null) {//GEN-END:|142-getter|0|142-preInit
            // write pre-init user code here
            exitCommand4 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|142-getter|1|142-postInit
            // write post-init user code here
        }//GEN-BEGIN:|142-getter|2|
        return exitCommand4;
    }
    //</editor-fold>//GEN-END:|142-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCommand ">//GEN-BEGIN:|144-getter|0|144-preInit
    /**
     * Returns an initiliazed instance of cancelCommand component.
     * @return the initialized component instance
     */
    public Command getCancelCommand() {
        if (cancelCommand == null) {//GEN-END:|144-getter|0|144-preInit
            // write pre-init user code here
            cancelCommand = new Command("Retry", Command.CANCEL, 0);//GEN-LINE:|144-getter|1|144-postInit
            // write post-init user code here
        }//GEN-BEGIN:|144-getter|2|
        return cancelCommand;
    }
    //</editor-fold>//GEN-END:|144-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem3 ">//GEN-BEGIN:|151-getter|0|151-preInit
    /**
     * Returns an initiliazed instance of stringItem3 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem3() {
        if (stringItem3 == null) {//GEN-END:|151-getter|0|151-preInit
            // write pre-init user code here
            stringItem3 = new StringItem("Operation Successful", "", Item.PLAIN);//GEN-BEGIN:|151-getter|1|151-postInit
            stringItem3.setLayout(ImageItem.LAYOUT_CENTER | Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER);//GEN-END:|151-getter|1|151-postInit
            // write post-init user code here
        }//GEN-BEGIN:|151-getter|2|
        return stringItem3;
    }
    //</editor-fold>//GEN-END:|151-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: Restore ">//GEN-BEGIN:|152-getter|0|152-preInit
    /**
     * Returns an initiliazed instance of Restore component.
     * @return the initialized component instance
     */
    public WaitScreen getRestore() {
        if (Restore == null) {//GEN-END:|152-getter|0|152-preInit
            // write pre-init user code here
            Restore = new WaitScreen(getDisplay());//GEN-BEGIN:|152-getter|1|152-postInit
            Restore.setTitle("Restore");
            Restore.setCommandListener(this);
            Restore.setImage(getImage1());
            Restore.setText("Restore is in progress, \nplease be patient..");
            Restore.setTask(getTask1());//GEN-END:|152-getter|1|152-postInit
            // write post-init user code here
        }//GEN-BEGIN:|152-getter|2|
        return Restore;
    }
    //</editor-fold>//GEN-END:|152-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: RestoreSuccess ">//GEN-BEGIN:|156-getter|0|156-preInit
    /**
     * Returns an initiliazed instance of RestoreSuccess component.
     * @return the initialized component instance
     */
    public Form getRestoreSuccess() {
        if (RestoreSuccess == null) {//GEN-END:|156-getter|0|156-preInit
            // write pre-init user code here
            RestoreSuccess = new Form("Restore Successful", new Item[] { getStringItem4(), getStringItem7() });//GEN-BEGIN:|156-getter|1|156-postInit
            RestoreSuccess.addCommand(getBackCommand5());
            RestoreSuccess.addCommand(getExitCommand5());
            RestoreSuccess.setCommandListener(this);//GEN-END:|156-getter|1|156-postInit
            // write post-init user code here
        }//GEN-BEGIN:|156-getter|2|
        return RestoreSuccess;
    }
    //</editor-fold>//GEN-END:|156-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: RestoreFailed ">//GEN-BEGIN:|157-getter|0|157-preInit
    /**
     * Returns an initiliazed instance of RestoreFailed component.
     * @return the initialized component instance
     */
    public Form getRestoreFailed() {
        if (RestoreFailed == null) {//GEN-END:|157-getter|0|157-preInit
            // write pre-init user code here
            RestoreFailed = new Form("Restore Failed", new Item[] { getStringItem5(), getStringItem8() });//GEN-BEGIN:|157-getter|1|157-postInit
            RestoreFailed.addCommand(getBackCommand6());
            RestoreFailed.addCommand(getExitCommand6());
            RestoreFailed.addCommand(getCancelCommand1());
            RestoreFailed.setCommandListener(this);//GEN-END:|157-getter|1|157-postInit
            // write post-init user code here
        }//GEN-BEGIN:|157-getter|2|
        return RestoreFailed;
    }
    //</editor-fold>//GEN-END:|157-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: task1 ">//GEN-BEGIN:|155-getter|0|155-preInit
    /**
     * Returns an initiliazed instance of task1 component.
     * @return the initialized component instance
     */
    public SimpleCancellableTask getTask1() {
        if (task1 == null) {//GEN-END:|155-getter|0|155-preInit
            // write pre-init user code here
            task1 = new SimpleCancellableTask();//GEN-BEGIN:|155-getter|1|155-execute
            task1.setExecutable(new org.netbeans.microedition.util.Executable() {
                public void execute() throws Exception {//GEN-END:|155-getter|1|155-execute


                    //InitCList();
                pim =PIM.getInstance();
                String contactName="";
                String contactNo="";
                Contact newContact;
                try {
                    clist = (ContactList)pim.openPIMList(pim.CONTACT_LIST, pim.READ_WRITE);
                } catch (PIMException ex) {
                    ex.printStackTrace();
                }
                synchronize.Synchronize_Stub sync = new synchronize.Synchronize_Stub();
                try {
                    contactCount = sync.countContacts(accountUsername);
                }catch(Exception e){}
                for (int i = 1 ; i<=contactCount; i++)
                {
                    try {
                       contactName = sync.getContactbyID(accountUsername, i);
                    } catch (RemoteException ex) {
                        ex.printStackTrace();
                    }
                    try {
                        contactNo = sync.getContactNumber(accountUsername, contactName);
                    } catch (RemoteException ex) {
                        ex.printStackTrace();
                    }
                   // if (!contactNo.equals(getContactByName(contactName)))
                    //{
                    newContact = clist.createContact();
                    newContact.addString(Contact.FORMATTED_NAME, PIMItem.ATTR_NONE, contactName);
                    newContact.addString(Contact.TEL, Contact.ATTR_MOBILE, contactNo);
                    try {
                        newContact.commit();
                    } catch (PIMException ex) {
                        ex.printStackTrace();
                    }
                   // }
                }// write task-execution user code here
                }//GEN-BEGIN:|155-getter|2|155-postInit
            });//GEN-END:|155-getter|2|155-postInit
            // write post-init user code here
        }//GEN-BEGIN:|155-getter|3|
        return task1;
    }
    //</editor-fold>//GEN-END:|155-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem6 ">//GEN-BEGIN:|178-getter|0|178-preInit
    /**
     * Returns an initiliazed instance of stringItem6 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem6() {
        if (stringItem6 == null) {//GEN-END:|178-getter|0|178-preInit
            // write pre-init user code here
            stringItem6 = new StringItem("Operation Failed", "");//GEN-BEGIN:|178-getter|1|178-postInit
            stringItem6.setLayout(ImageItem.LAYOUT_CENTER | Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER);//GEN-END:|178-getter|1|178-postInit
            // write post-init user code here
        }//GEN-BEGIN:|178-getter|2|
        return stringItem6;
    }
    //</editor-fold>//GEN-END:|178-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem4 ">//GEN-BEGIN:|176-getter|0|176-preInit
    /**
     * Returns an initiliazed instance of stringItem4 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem4() {
        if (stringItem4 == null) {//GEN-END:|176-getter|0|176-preInit
            // write pre-init user code here
            stringItem4 = new StringItem("Operation Successful", "");//GEN-BEGIN:|176-getter|1|176-postInit
            stringItem4.setLayout(ImageItem.LAYOUT_CENTER | Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER);//GEN-END:|176-getter|1|176-postInit
            // write post-init user code here
        }//GEN-BEGIN:|176-getter|2|
        return stringItem4;
    }
    //</editor-fold>//GEN-END:|176-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem5 ">//GEN-BEGIN:|177-getter|0|177-preInit
    /**
     * Returns an initiliazed instance of stringItem5 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem5() {
        if (stringItem5 == null) {//GEN-END:|177-getter|0|177-preInit
            // write pre-init user code here
            stringItem5 = new StringItem("Operation Failed", "");//GEN-BEGIN:|177-getter|1|177-postInit
            stringItem5.setLayout(ImageItem.LAYOUT_CENTER | Item.LAYOUT_TOP | Item.LAYOUT_BOTTOM | Item.LAYOUT_VCENTER);//GEN-END:|177-getter|1|177-postInit
            // write post-init user code here
        }//GEN-BEGIN:|177-getter|2|
        return stringItem5;
    }
    //</editor-fold>//GEN-END:|177-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand5 ">//GEN-BEGIN:|161-getter|0|161-preInit
    /**
     * Returns an initiliazed instance of backCommand5 component.
     * @return the initialized component instance
     */
    public Command getBackCommand5() {
        if (backCommand5 == null) {//GEN-END:|161-getter|0|161-preInit
            // write pre-init user code here
            backCommand5 = new Command("Back", Command.BACK, 0);//GEN-LINE:|161-getter|1|161-postInit
            // write post-init user code here
        }//GEN-BEGIN:|161-getter|2|
        return backCommand5;
    }
    //</editor-fold>//GEN-END:|161-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand5 ">//GEN-BEGIN:|163-getter|0|163-preInit
    /**
     * Returns an initiliazed instance of exitCommand5 component.
     * @return the initialized component instance
     */
    public Command getExitCommand5() {
        if (exitCommand5 == null) {//GEN-END:|163-getter|0|163-preInit
            // write pre-init user code here
            exitCommand5 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|163-getter|1|163-postInit
            // write post-init user code here
        }//GEN-BEGIN:|163-getter|2|
        return exitCommand5;
    }
    //</editor-fold>//GEN-END:|163-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand6 ">//GEN-BEGIN:|167-getter|0|167-preInit
    /**
     * Returns an initiliazed instance of backCommand6 component.
     * @return the initialized component instance
     */
    public Command getBackCommand6() {
        if (backCommand6 == null) {//GEN-END:|167-getter|0|167-preInit
            // write pre-init user code here
            backCommand6 = new Command("Back", Command.BACK, 0);//GEN-LINE:|167-getter|1|167-postInit
            // write post-init user code here
        }//GEN-BEGIN:|167-getter|2|
        return backCommand6;
    }
    //</editor-fold>//GEN-END:|167-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand6 ">//GEN-BEGIN:|169-getter|0|169-preInit
    /**
     * Returns an initiliazed instance of exitCommand6 component.
     * @return the initialized component instance
     */
    public Command getExitCommand6() {
        if (exitCommand6 == null) {//GEN-END:|169-getter|0|169-preInit
            // write pre-init user code here
            exitCommand6 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|169-getter|1|169-postInit
            // write post-init user code here
        }//GEN-BEGIN:|169-getter|2|
        return exitCommand6;
    }
    //</editor-fold>//GEN-END:|169-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCommand1 ">//GEN-BEGIN:|171-getter|0|171-preInit
    /**
     * Returns an initiliazed instance of cancelCommand1 component.
     * @return the initialized component instance
     */
    public Command getCancelCommand1() {
        if (cancelCommand1 == null) {//GEN-END:|171-getter|0|171-preInit
            // write pre-init user code here
            cancelCommand1 = new Command("Retry", Command.CANCEL, 0);//GEN-LINE:|171-getter|1|171-postInit
            // write post-init user code here
        }//GEN-BEGIN:|171-getter|2|
        return cancelCommand1;
    }
    //</editor-fold>//GEN-END:|171-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem9 ">//GEN-BEGIN:|181-getter|0|181-preInit
    /**
     * Returns an initiliazed instance of stringItem9 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem9() {
        if (stringItem9 == null) {//GEN-END:|181-getter|0|181-preInit
            // write pre-init user code here
            stringItem9 = new StringItem("", "Contacts backup was successful");//GEN-LINE:|181-getter|1|181-postInit
            // write post-init user code here
        }//GEN-BEGIN:|181-getter|2|
        return stringItem9;
    }
    //</editor-fold>//GEN-END:|181-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem10 ">//GEN-BEGIN:|182-getter|0|182-preInit
    /**
     * Returns an initiliazed instance of stringItem10 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem10() {
        if (stringItem10 == null) {//GEN-END:|182-getter|0|182-preInit
            // write pre-init user code here
            stringItem10 = new StringItem("", "Contacts backup failed");//GEN-LINE:|182-getter|1|182-postInit
            // write post-init user code here
        }//GEN-BEGIN:|182-getter|2|
        return stringItem10;
    }
    //</editor-fold>//GEN-END:|182-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem7 ">//GEN-BEGIN:|179-getter|0|179-preInit
    /**
     * Returns an initiliazed instance of stringItem7 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem7() {
        if (stringItem7 == null) {//GEN-END:|179-getter|0|179-preInit
            // write pre-init user code here
            stringItem7 = new StringItem("", "Contacts restored successfully");//GEN-LINE:|179-getter|1|179-postInit
            // write post-init user code here
        }//GEN-BEGIN:|179-getter|2|
        return stringItem7;
    }
    //</editor-fold>//GEN-END:|179-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem8 ">//GEN-BEGIN:|180-getter|0|180-preInit
    /**
     * Returns an initiliazed instance of stringItem8 component.
     * @return the initialized component instance
     */
    public StringItem getStringItem8() {
        if (stringItem8 == null) {//GEN-END:|180-getter|0|180-preInit
            // write pre-init user code here
            stringItem8 = new StringItem("", "Contacts restore failed");//GEN-LINE:|180-getter|1|180-postInit
            // write post-init user code here
        }//GEN-BEGIN:|180-getter|2|
        return stringItem8;
    }
    //</editor-fold>//GEN-END:|180-getter|2|
    //</editor-fold>
    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay () {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable (null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet ();
        } else {
            initialize ();
            startMIDlet ();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }

    public void InitCList()
    {
                 pim =PIM.getInstance();
                Contact contact;
                Enumeration enumeration = null;
                String[] lists = pim.listPIMLists(pim.CONTACT_LIST);
                contacts = new String [2][200];
		for (int i = 0; i < lists.length; i++)
		{
		try{
		pimlist = pim.openPIMList(pim.CONTACT_LIST,pim.READ_WRITE);
		}catch(Exception e){}
		try{
		enumeration = pimlist.items();
		}catch(Exception e){}
                int id=0;
		while (enumeration.hasMoreElements())
		{
		 contact	=	(Contact)enumeration.nextElement();
		 try{
			if(pimlist.isSupportedField(Contact.FORMATTED_NAME)&& (contact.countValues(Contact.FORMATTED_NAME) >0))
			 {
				contacts[0][id] = contact.getString(Contact.FORMATTED_NAME,0);
			 }
		}catch( Exception e){}
		try{
			if(pimlist.isSupportedField(Contact.TEL) &&(contact.countValues(Contact.TEL) >0))
			contacts[1][id] = contact.getString(Contact.TEL, 0);
			}catch( Exception e){}
                 id++;

		}

                }   
    }
    public String getContactByName(String Name)
    {
        for(int i = 0; i<200 ; i++)
        {
            if(contacts[0][i].equals(Name))
            {
                return contacts[1][i];
            }
        }
        return "false";
    }
        
        
}

